package day7;

/**
 * @author oldliu
 * @since 1.0
 */
public class Person {
    private String name;
    private int age;
    private String phone;
    private final String sex;//一旦确定，不能改。。。
    //无论加什么构造方法，sex都必须给值
    public Person(){
        sex="女";
    }
    public Person(String name, int age) {
        this.name = name;
        this.age = age;
        this.sex="男";
    }

    public Person(String name, int age, String phone, String sex) {
        this.name = name;
        this.age = age;
        this.phone = phone;
        this.sex = sex;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getSex() {
        return sex;
    }
//    public void setSex(String s){
//        this.sex=s;//error
//    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", phone='" + phone + '\'' +
                ", sex='" + sex + '\'' +
                '}';
    }
}
